import { ApiCall } from "tsrpc";
import master from "../..";
import app from "../../../app";
import { player } from "../../../model/fight/body/player";
import manage_word from "../../model/manage/manage_word";
import { wordCfg } from "../../../model/word/word";
import { template } from "../../../shared/master/MsgAction";
import { ReqJoinCopyWord, ResJoinCopyWord } from "../../../shared/master/word/PtlJoinCopyWord";

export default async function (call: ApiCall<ReqJoinCopyWord, ResJoinCopyWord>) {
    call.succ({});
    let user = call.req._player as player;
    let id = manage_word.mateWord_id(user);
    if(id == '1'){
        user.sendMsg(template.default,'暂无符合您等级的世界.敬请期待')
        return;
    }
    let res = await manage_word.transfer(user,id)
    await user.sendMsg(template.default, res.msg);
    if(res.jude){
        user.callApi('word/Position',{})
    }
}